<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <title>数据导入 - 食物食材食品基本信息Web系统</title>
  <link rel="stylesheet" href="css/style.css">
  <script>
    if (!sessionStorage.getItem('isLoggedIn')) {
      window.location.href = 'login.html';
    }
  </script>
</head>
<body>
  <div class="bg"></div>
  <div class="bg bg2"></div>
  <div class="bg bg3"></div>
  <header>
    <h1>食物食材食品基本信息Web系统</h1>
    <nav>
      <div class="user-menu" id="userMenu">
        <img src="img/avatar.png" alt="头像" class="avatar" id="userAvatar">
        <span class="username" id="usernameDisplay">用户</span>
        <span class="dropdown-arrow">&#9662;</span>
        <div class="dropdown-menu" id="dropdownMenu">
          <a href="#" id="profileLink"><span class="menu-icon">&#8962;</span> 个人空间</a>
          <a href="login.html" id="logout"><span class="menu-icon">&#9906;</span> 退出登录</a>
        </div>
      </div>
    </nav>
  </header>
  <main>
    <a href="index.html" class="back-home-btn"><span>返回首页</span></a>
    <section>
      <div class="intro-card">
        <h2 style="font-family: inherit; font-weight: bold;">数据导入</h2>
        <p>批量导入食物、食材、食品信息</p>
        <p style="color:#388e3c;font-weight:500;margin-top:8px;">请选择要导入的表和文件</p>
      </div>
      <div class="admin-section" style="max-width:480px;margin:32px auto 0 auto;">
        <form id="importForm">
          <div class="form-group">
            <label for="importTable">选择表：</label>
            <select id="importTable" name="importTable" required>
              <option value="">请选择要导入的表</option>
              <option value="foods">食物</option>
              <option value="ingredients">食材</option>
              <option value="products">食品</option>
            </select>
          </div>
          <div class="form-group">
            <label for="importFile">选择Excel文件：</label>
            <input type="file" id="importFile" name="importFile" accept=".xls,.xlsx" required>
          </div>
          <div class="form-actions" style="justify-content:flex-end;gap:16px;">
            <button type="submit" class="btn btn-primary" style="width:120px;">导入</button>
            <a href="index.html" class="btn btn-secondary" style="width:120px;">返回</a>
          </div>
        </form>
        <div id="importResult" style="margin-top:16px;text-align:center;"></div>
      </div>
    </section>
  </main>
  <footer>
    <p>&copy; 2025 食物食材食品基本信息Web系统</p>
  </footer>
  <script src="js/user_menu.js"></script>
  <script src="js/import.js"></script>
</body>
</html> 